//
//  KeChengXueNextWoDeZiYuanViewCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/17.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "KeChengXueNextWoDeZiYuanViewCell.h"

@interface KeChengXueNextWoDeZiYuanViewCell ()
@property (strong, nonatomic) UIView *fgxView;


@end


@implementation KeChengXueNextWoDeZiYuanViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
    }
    return self;
}
- (UIView *)backView{
    if (!_backView) {
        UIView *view = [[UIView alloc]init];
        _backView = view;
    }
    return _backView;
}
- (UIView *)fgxView {
    if (!_fgxView) {
        _fgxView = [[UIView alloc] init];
        _fgxView.backgroundColor = [UIColor colorWithHexString:@"#cccccc"];
        _fgxView.alpha = 0.8;
    }
    return _fgxView;
}

- (void)initSubView{
    [self addSubview:self.backView];
    [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@40);
        make.right.equalTo(@0).offset(-40);
        make.centerY.equalTo(self.mas_centerY);
        make.height.equalTo(@50);
    }];
    [_backView addSubview:self.leftImageView];
    [_leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@40);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@26);
        make.height.equalTo(@23);
    }];
    [_backView addSubview:self.titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageView.mas_right).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_centerX);
        make.height.equalTo(@23);
    }];
    [_backView addSubview:self.detailLabel];
    [_detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_centerX).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@100);
        make.height.equalTo(@23);
    }];
    [_backView addSubview:self.rightButton];
    [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@0).offset(-100);
        make.centerY.equalTo(self.mas_centerY);
        make.width.equalTo(@16);
        make.height.equalTo(@21);
    }];
    [_backView addSubview:self.fgxView];
    [_fgxView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.backView.mas_bottom).offset(-1);
        make.left.equalTo(@40);
        make.right.equalTo(@0).offset(-100);
        make.height.mas_equalTo(1);
    }];
}
- (UIImageView *)leftImageView{
    if (!_leftImageView) {
        UIImageView *imageView = [[UIImageView alloc]init];
        imageView.image = [UIImage imageNamed:@"wenJian_type1"];
        _leftImageView = imageView;
    }
    return _leftImageView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(422,216.5,145.5,11.5);
        label.numberOfLines = 0;
        label.font = [UIFont systemFontOfSize:14];
        label.text = @"慧阅读2-2-C    Lesson 25";
        label.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)detailLabel{
    if (!_detailLabel) {
        UILabel *label = [[UILabel alloc] init];
        label.frame = CGRectMake(422,216.5,145.5,11.5);
        label.numberOfLines = 0;
        label.text = @"82.5MB";
        label.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
        label.font = [UIFont systemFontOfSize:12];
        _detailLabel = label;
    }
    return _detailLabel;
}
- (UIButton *)rightButton{
    if (!_rightButton) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setImage:[UIImage imageNamed:@"boFang_image"] forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:12];
        [button setTitleColor:SELECTEDCOLOR forState:0];
        [button addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
        button.userInteractionEnabled = NO;
        _rightButton = button;
    }
    return _rightButton;
}
- (void)back:(UIButton *)sender{
 
}

@end
